<template>
  <div class="container">
    <div class="main">
      <div class="header">试题录入</div>
      <div class="form">
        <el-form
          :model="form"
          :rules="rules"
          ref="form"
          label-width="100px"
          class="demo-ruleForm"
        >
          <el-form-item label="学科" prop="">
            <el-select v-model="form.one" placeholder="请选择活动区域">
              <el-option label="区域一" value="shanghai"></el-option>
              <el-option label="区域二" value="beijing"></el-option>
            </el-select>
          </el-form-item>
            <el-form-item label="目录" prop="">
            <el-select v-model="form.one2" placeholder="请选择活动区域">
              <el-option label="区域一" value="shanghai"></el-option>
              <el-option label="区域二" value="beijing"></el-option>
            </el-select>
          </el-form-item>
            <el-form-item label="企业" prop="">
            <el-select v-model="form.one3" placeholder="请选择活动区域">
              <el-option label="区域一" value="shanghai"></el-option>
              <el-option label="区域二" value="beijing"></el-option>
            </el-select>
          </el-form-item>

           <el-form-item label="城市" >
          <el-select v-model="form.province" placeholder="请选择" @change="selectCity()">
            <el-option v-for="item in province" :key="item" :label="item" :value="item"></el-option>
          </el-select>
          <el-select v-model="form.region" placeholder="请选择">
            <el-option v-for="item in city" :key="item" :label="item" :value="item"></el-option>
          </el-select>
        </el-form-item>

           <el-form-item label="方向" prop="">
            <el-select v-model="form.one3" placeholder="请选择活动区域">
              <el-option label="区域一" value="shanghai"></el-option>
              <el-option label="区域二" value="beijing"></el-option>
            </el-select>
          </el-form-item>

<el-form-item label="题型" >
         <template>
         <el-radio v-model="form.one" label="1">备选项</el-radio>
         <el-radio v-model="form.one" label="2">备选项</el-radio>
         <el-radio v-model="form.one" label="2">备选项</el-radio>
         </template>
   </el-form-item>

   <el-form-item label="难度" >
         <template>
         <el-radio v-model="form.one" label="1">备选项</el-radio>
         <el-radio v-model="form.one" label="2">备选项</el-radio>
         <el-radio v-model="form.one" label="2">备选项</el-radio>
         </template>
   </el-form-item>

          <el-form-item>
            <el-button type="primary" @click="submitForm('form')"
              >立即创建</el-button
            >
            <el-button @click="resetForm('form')">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
import { provinces, citys } from '@/api/hmmm/citys.js'
export default {
  data () {
    return {
      province: [],
      city: [],
      form: {
        province: '',
        city: '',
        one: '',
        one2: '',
        one3: ''
      },
      rules: {
      }
    }
  },
  methods: {
    selectCity () {
      this.city = citys(this.form.province)
    },
    submitForm (formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert('submit!')
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
    resetForm (formName) {
      this.$refs[formName].resetFields()
    }
  },
  created () {
    this.province = provinces()
  }
}
</script>

<style scoped lang="less">
.container {
  padding: 20px;
  .main {
    padding: 20px;
    background-color: #fff;
    .header {
      height: 50px;
      line-height: 50px;
      padding-left: 20px;
      border-bottom: 1px solid #ccc;
    }
  }
}
</style>
